import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AgentInfoRelationVO, AgentInfoRelationForm, AgentInfoRelationQuery } from '@/api/commission/agentInfoRelation/types';

/**
 * 查询代理商信息关系列表
 * @param query
 * @returns {*}
 */

export const listAgentInfoRelation = (query?: AgentInfoRelationQuery): AxiosPromise<AgentInfoRelationVO[]> => {
  return request({
    url: '/commission/agentInfoRelation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询代理商信息关系详细
 * @param id
 */
export const getAgentInfoRelation = (id: string | number): AxiosPromise<AgentInfoRelationVO> => {
  return request({
    url: '/commission/agentInfoRelation/' + id,
    method: 'get'
  });
};

/**
 * 新增代理商信息关系
 * @param data
 */
export const addAgentInfoRelation = (data: AgentInfoRelationForm) => {
  return request({
    url: '/commission/agentInfoRelation',
    method: 'post',
    data: data
  });
};

/**
 * 修改代理商信息关系
 * @param data
 */
export const updateAgentInfoRelation = (data: AgentInfoRelationForm) => {
  return request({
    url: '/commission/agentInfoRelation',
    method: 'put',
    data: data
  });
};

/**
 * 删除代理商信息关系
 * @param id
 */
export const delAgentInfoRelation = (id: string | number | Array<string | number>) => {
  return request({
    url: '/commission/agentInfoRelation/' + id,
    method: 'delete'
  });
};
